/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package ubisaluswifiadaptor;

import Controller.Controller;
import GUI.GUITest;
import GUI.WiFiAdaptorGUI;
import NetCommunicator.NetCommunicator;
import jWASA.Sensor;
import jWASA.SensorEKG;
import java.net.Inet4Address;
import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.TooManyListenersException;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author gianmariospacagna
 */
public class ubisaluswifiadaptorTest {

    public static void main(String[] args) {
        // TODO code application logic here
        new GUITest(new ubisaluswifiadaptorTest()).setVisible(true);


    }

    public ubisaluswifiadaptorTest() {
    }

    public void sendSample() {
        try {
            NetCommunicator netCommunicator = new NetCommunicator(Inet4Address.getByName("localhost"), 2012);
            long[] value = new long[1];
            value[0] = 10;
            Sensor ekg = new SensorEKG("EKG", "EKG Sensor by Gianmario and Giuseppe", 2, 1);
            netCommunicator.sendData(new jWASA.Sample(System.nanoTime(), value, ekg));
        } catch (UnknownHostException ex) {
            Logger.getLogger(ubisaluswifiadaptorTest.class.getName()).log(Level.SEVERE, null, ex);
        }
    }

    public void activateRT() {
        Controller controller = new Controller();
        try {
            controller.startMonitoring(controller.getSensors(),4);
        } catch (TooManyListenersException ex) {
            Logger.getLogger(ubisaluswifiadaptorTest.class.getName()).log(Level.SEVERE, null, ex);
        }

    }
}
